package com.atguigu.gulimall.product.service.impl;

import com.atguigu.gulimall.product.service.TestService;
import org.springframework.data.redis.core.BoundHashOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;

/**
 * @Author caowc
 * @Date 2024/1/7 10:01
 * @Description:
 */
@Service
public class TestServiceImpl implements TestService {

    @Resource
    private RedisTemplate redisTemplate;
    private final String key = "seckill:sessions:";

    // MR測試回滾1111
    @Override
    public void testRedis() {
//        redisTemplate.opsForValue().set("123","京东订单"+ "4326537");

        BoundHashOperations<String, Object, Object> hashOps = redisTemplate.boundHashOps("redis");
        hashOps.put("order#df", "京东订单"+ "4326537");
        hashOps.put("order#df2", "京东订单"+ "43265dff37");

//        List<String> re = Arrays.asList("dd","ff");
//        redisTemplate.opsForList().leftPushAll(key+"202402123_20340607","京东订单",re);
    }
}
